home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / kiss-0.11 / kiss-0 / kiss / src / runinternal.c < prev    next >
C/C++ Source or Header  |  1995-03-23  |  778b  |  41 lines

  1. #include "kiss.h"
  2.  
  3. int runinternal (Stringstack s)
  4. {
  5.     register int
  6.     i;
  7.     Stringstack
  8.     tmp = { NULL, 0 };
  9.  
  10.     /* is command flagged as immediate? */
  11.     if ( ( (i = isinternal (s.str [0])) != -1 ) &&
  12.      (cmdtable [i].firstlevel)
  13.        )
  14.     {
  15.     laststatus = cmdtable [i].cmd (s);
  16.     return (1);
  17.     }
  18.  
  19.     /* "VAR = value" is a special case: remap to "setenv VAR value" */
  20.     if ( (s.nstr == 3 || s.nstr == 2) && !strcmp (s.str [1], "=") )
  21.     {
  22.     addstringtostack (&tmp, "setenv");
  23.     addstringtostack (&tmp, s.str [0]);
  24.     
  25.     if (s.nstr == 3)
  26.     {
  27.         addstringtostack (&tmp, s.str [2]);
  28.         laststatus = dosetenv (tmp);
  29.     }
  30.     else
  31.         laststatus = dounsetenv (tmp);
  32.     
  33.      clearstack (&tmp); 
  34.     return (1);
  35.     }
  36.  
  37.     /* fall thru: not an immediate command */
  38.     return (0);
  39. }
  40.     
  41.